const Router = require('koa-router');
const { verifyAuth, verifyPermission } = require('../middleware/auth.middleware');
const { create, reply, remove, list } = require('../controller/discuss.controller');
const { support } = require('../controller/support.controller');

const discussRouter = new Router({ prefix: "/discuss" });

// 创建一条评论
discussRouter.post("/", verifyAuth, create);
// 回复一条评论
discussRouter.post("/reply", verifyAuth, reply);
// 删除一条评论
discussRouter.delete("/:discussId", verifyAuth, verifyPermission, remove);
// 点赞一条评论
discussRouter.get("/:discuss/support", verifyAuth, support);
// 获取评论列表
discussRouter.get("/", list);

module.exports = discussRouter;
